package com.xbkj.pgrp.server.model.app;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.PreDataProxy;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.upms.model.base.HyperDataProxy;
import xyz.erupt.upms.model.base.HyperModel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

@Erupt(
        name = "法定节假日日期"
)
@Setter
@Getter
@Entity
@Table(name = "work_and_holidays")
@PreDataProxy(HyperDataProxy.class)
public class WorkAndHolidays extends HyperModel {
    @EruptField(
            views = @View(title = "工作日"),
            edit = @Edit(title = "工作日", dateType = @DateType(type = DateType.Type.DATE), notNull = true)
    )
    @Column(name = "workday", unique = true)
    private Date workday;

    /**
     * 是否是工作日的标志， 0-非工作日，1-工作日
     */
    @EruptField(
            views = @View(title = "是否是工作日"),
            edit = @Edit(title = "是否是工作日", notNull = true, type = EditType.CHOICE,
                    choiceType = @ChoiceType(vl = {
                            @VL(value = "0", label = "非工作日"),
                            @VL(value = "1", label = "工作日")
                    })
            )
    )
    @Column(name = "flag", length = 1)
    private String flag;
}
